<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of category_model
 * 
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Admin_banner_model extends CI_Model {

    //put your code here


    function __construct() {
        parent::__construct();
        log_message('debug', 'Init Model Initialized');
    }

   function get_banners($order_type=NULL, $num=NULL, $offset=NULL){ 
	   $subcond = " where status=51";
	   $limit = '';       
		  if ($num > 0)
				$limit = ' limit '.$offset.',' . $num;			
	  $sql="select * from banners" .$subcond. ' order by ' . $order_type . $limit;
	  $query=$this->db->query($sql);
	  $result=$query->result();
  
  return $result;
  }
 function get_banner_by_id($id){
    if (isset($id)) {
	 $sql="select * from banners where id=$id";
	 $query=$this->db->query($sql);
	 $result=$query->row();
	 return $result;
 }
 } 
}